Re: [SQL] Creating table with unique key.

Поиск
Список
Период
Сортировка
От lynch@lscorp.com (Richard Lynch)
Тема Re: [SQL] Creating table with unique key.
Дата
Msg-id v02140b58b1ee55140c5b@[207.152.64.133]
обсуждение исходный текст
Ответы Re: [SQL] Creating table with unique key.  (Tom Good <tomg@nrnet.org>)
Re: [SQL] Creating table with unique key.  (pierre@desertmoon.com)
Список pgsql-sql
At 2:49 PM 8/5/98, Colin Dick wrote:
>> > CREATE TABLE cliente (
>> >         name    varchar(100) UNIQUE NOT NULL,
>> >         username        varchar(8) NOT NULL ,
>> >         key     int4 NOT NULL DEFAULT nextval('key_s') PRIMARY KEY,

There should be no comma (,) in the last field description.

>> >         );
>
>Hi this is from a previous post regarding auto-incrementing.  I have that
>part working, now I am trying to create a table with a field which will
>not be null and will be unique to the rest of table.  Is this possible and
>what is the correct syntax.  I have tried and receeved the following:
>

CREATE TABLE cust (
  FileNumber int4 unique not null,
  CompName varchar(50),
  FirstName varchar(50),
  LastName varchar(50),
  BirthDate varchar(8),
  Suite varchar(5),
  Address varchar(50),
  City varchar(20),
  Province varchar(20),
  PostalCode varchar(7),
  Email varchar(50),
  HomePhone varchar(14),
  WorkPhone varchar(14),
  FaxPhone varchar(14));

>WARN:parser: parse error at or near "unique"
>
>Can someone point me in the right direction.  Thanks.

www.postgresql.org/docs/man/create_table.1.html does not seem to allow for
any spiffy keywords like UNIQUE nor PRIMARY KEY... at least not if I'm
understanding it properly.

Disclaimer:  I think the docs are wrong, not that at least one of them
won't work.

--
--
-- "TANSTAAFL" Rich lynch@lscorp.com



В списке pgsql-sql по дате отправления:

Предыдущее
От: lynch@lscorp.com (Richard Lynch)
Дата:
Сообщение: Re: mere millimetres away
Следующее
От: darcy@druid.net (D'Arcy J.M. Cain)
Дата:
Сообщение: Re: [SQL] What is the recommended machine configuration?